/**
 * @author Ahammer
 * @date 2009 04
 */

/*
 * This file is part of Iqm.
 * Copyright (c) 2010-2011 Helmut Ahammer
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package opjai;
import javax.media.jai.JAI;
import javax.media.jai.OperationDescriptorImpl;
import javax.media.jai.OperationRegistry;
import javax.media.jai.registry.RIFRegistry;
import javax.media.jai.util.Range;

/**
 * This class defines the PointOpImage operator "IqmRGBRelative" for JAI
 * 
 */
public class IqmRGBRelativeDescriptor extends OperationDescriptorImpl {
	
  private static final String[][] resources = {
      {"GlobalName",   "IqmRGBRelative"},
      {"LocalName",    "IqmRGBRelative"},
      {"Vendor",       "mug.qmnm"},
      {"Description",  "RGB relative segmentation of RGB color images"},
      {"DocURL",       "http://code.google.com/p/iqm/"},
      {"Version",      "1.0"},
      {"arg0Desc",     "band"}, 
      {"arg1Desc",     "percentage"}, 
      {"arg2Desc",     "binarize"},        
  };
  private static final String[] supportedModes   = {"rendered"};
  private static final int      numSources       = 1;
  private static final String[] paramNames       = {"Band", "Ratio", "Binarize"};
  private static final Class[]  paramClasses     = {Integer.class, Integer.class, Integer.class, };
  private static final Object[] paramDefaults    = {0, 50, 0};   
  private static final Range[]  validParamValues = {new Range(Integer.class, 0,2), //R,G,B
	  												new Range(Integer.class, 0,100),
	  												new Range(Integer.class, 0,1)};
 
 /**
  * constructor
  */ 
  public IqmRGBRelativeDescriptor() {
    super(resources, supportedModes, numSources, paramNames, paramClasses, paramDefaults, validParamValues);
  }

 /**
  * This method registers this method 
  */
  public static void register() {
      OperationRegistry opReg = JAI.getDefaultInstance().getOperationRegistry();   
      IqmRGBRelativeDescriptor descriptor = new IqmRGBRelativeDescriptor();
      opReg.registerDescriptor(descriptor);  
      IqmRGBRelativeRIF rif = new IqmRGBRelativeRIF();
      RIFRegistry.register(opReg, "iqmrgbrelative", "Iqm", rif);
   }
  
} //END
